package com.test.servicedemo;
/**引入包*/

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.text.Layout;
import android.text.StaticLayout;
import android.text.TextPaint;
import android.view.View;


public class UseBriderFace extends View{
    /**创建参数*/
    public UseBriderFace(Context context){
        super(context);
    }
    public void onDraw(Canvas canvas){
        canvas.drawColor(Color.WHITE);//画白色背景
        /**绘制文字*/
        TextPaint textPaint = new TextPaint();
        textPaint.setColor(Color.RED);
        textPaint.setTextSize(100);
        canvas.drawText("使用绑定服务", 10, 100, textPaint);
        textPaint.setColor(Color.GREEN);
        textPaint.setTextSize(60);
        String message = "使用绑定服务后，这个Activity关闭后 绑定的服务也会关闭";
        StaticLayout layout = new StaticLayout(message,textPaint,getWidth(), Layout.Alignment.ALIGN_NORMAL,1.0F,0.0F,true);
        canvas.translate(0,120);
        layout.draw(canvas);


    }
}
